<?php


namespace app\admin\controller;

use app\common\controller\AdminController;
use app\common\model\EquipmentsModel;

class Equipments extends AdminController
{
    /**
     * 产品列表
     */
    public function index()
    {
        $company_id = input('param.company_id');
        $app_sn = input('param.app_sn');
        $this->assign('company_id', $company_id);
        $this->assign('app_sn', $app_sn);
        return $this->fetch();
    }

    /**
     * 设置产品服务费
     */
    public function sets()
    {
        $param = input('param.');
        $company_id = $param['company_id'];
        $equipments_sn = $param['equipments_sn'];
        $app_sn = $param['app_sn'];

        $data = [];
        //查询信息
        if (!empty($equipments_sn)) {
            $equipment_model = new EquipmentsModel();
            $data = $equipment_model->getOne(['equipments_sn' => $equipments_sn]);
            if (!empty($data)) {
                $data['new_install_service_money'] = formatMoney($data['new_install_service_money'], 2);
                $data['renew_service_money'] = formatMoney($data['renew_service_money'], 2);
            }

        }

        $this->assign('company_id', $company_id);
        $this->assign('equipments_sn', $equipments_sn);
        $this->assign('data', $data);
        $this->assign('app_sn', $app_sn);
        return $this->fetch();
    }


}